/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-10 15:29:26  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.bp.repository;

import java.util.List;

import com.joysuch.wwyt.bp.entity.BpRiskPromiseBraodcast;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

/**
 * BpRiskPromiseBraodcastDao
 * 
 */
public interface BpRiskPromiseBraodcastDao
        extends JpaRepository<BpRiskPromiseBraodcast, Long>, QuerydslPredicateExecutor<BpRiskPromiseBraodcast> {
    public Page<BpRiskPromiseBraodcast> findAll(Specification<BpRiskPromiseBraodcast> spec, Pageable pageable);

    public BpRiskPromiseBraodcast save(BpRiskPromiseBraodcast bean);

    public void delete(BpRiskPromiseBraodcast bean);

    public BpRiskPromiseBraodcast findFirstByDate(String date);

    @Query("select m from BpRiskPromiseBraodcast m where m.date <=?1 order by m.date desc")
    public List<BpRiskPromiseBraodcast> findLastest(String date, Pageable page);

    @Query("select m from BpRiskPromiseBraodcast m order by m.updateTime desc")
    public List<BpRiskPromiseBraodcast> findLastestOne(Pageable page);

}
